package com.design.pattern.command.command;

import com.design.pattern.command.drawer.Drawable;

import java.awt.*;

/**
 * 长沙先飞信息科技有限公司<br>
 * Created with IntelliJ IDEA.<br>
 * Date:2024/6/20<br>
 * Time:12:29<br>
 * 功能描述：<br>
 *      绘制一个点的命令
 * @author huang hou chun
 * @since JDK 1.8 <br>
 * Copyright (c) 2023 www.csxfrj.com System Incorporated All Rights Reserved.
 */
public class DrawCommand implements Command {

    // 绘制对象
    protected Drawable drawable;
    // 绘制位置
    protected Point position;
    // 构造函数
    public DrawCommand(Drawable drawable, Point position) {
        this.drawable = drawable;
        this.position = position;
    }

    @Override
    public void execute() {
        drawable.draw(position.x, position.y);
    }
}
